<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<%@ taglib uri="/WEB-INF/tlds/att.tld" prefix="att"%>
<html>
<head>
<meta name="decorator" content="moduleView" />
<script type="text/javascript">
	$(function() {
		$("#toSap").removeAttr("disabled");
	});
	
	function checkSupplierUser(id)
	{
		var contextPath = Com_Parameter.ContextPath;
		$.get(contextPath + "/biz/brand/supplierUser/"+id+"/checkSupplierUser", function(data) {
			var jsonObj = eval('(' + data + ')');
			if(jsonObj.isOpen == "false")
			{
				$("#username").val("");
				$("#password").val("");
				$("#password2").val("");
				$("#msg").html("");
				$("#username").removeAttr("readonly");
				$("#isOpenNo").removeAttr("checked");
				$('#openUserModal').modal('show');
				
			}else
			{
				top.$.jBox.tip("此供应商已开通过账号！",'warning');
			}
		});
	}
</script>
<style type="text/css">
h4{ border-bottom:1px dotted #ccc; padding-bottom:10px; margin:30px 0 15px; color:#b12028; font-size: 12px;}
</style>
</head>
<body>
		<div class="Report_f">
	        <div class="Report_f_1">
	             <div class="Report_f_title_1">供应商信息</div>
	             <div class="o-l-search-builder f_1">
			    	  <button type="button" class="btn btn-danger btn_5 btn_right" onclick="history.go(-1)">返&nbsp;回</button>
		              <button type="button" class="btn btn-info btn_5 btn_right" id="toSap" onclick="sendSingle('${contextPath}/biz/brand/supplier/${supplier.id}/sap?navId=${navId }','toSap')">发送SAP</button>
        			<button type="button" class="btn btn-success btn_5 btn_right" onclick="checkSupplierUser('${supplier.id}');">开通账号</button>
	        			<button type="button" class="btn btn-danger btn_5 btn_right" onclick="window.open('${contextPath}/biz/brand/supplier/${supplier.id}/delete?navId=${navId }','_self')">删&nbsp;除</button>
	        			<button type="button" class="btn btn-info btn_5 btn_right" onclick="window.open('${contextPath}/biz/brand/supplier/${supplier.id}/edit?navId=${navId }','_self')">修&nbsp;改</button>
        		</div> 
		
			<ul class="nav nav-tabs Report_f_title_2">
			<li class="active"><a href="#home" data-toggle="tab">基本信息</a></li>
			  <li><a href="#bus_tab"  data-toggle="tab"  >营业执照信息</a></li> 
			  <li><a href="#tax_tab"  data-toggle="tab"  >纳税人证明</a></li> 
			  <li><a href="#contacts_tab"  data-toggle="tab"  >联系方式</a></li> 
			  <li><a href="#bank_tab"  data-toggle="tab"  >银行账户</a></li> 
			  <li><a href="#coopBrand_tab"  data-toggle="tab"  >合作的品牌</a></li>
			  <li><a href="#att_tab"  data-toggle="tab"  >附件</a></li>
			  <li><a href="#workflow" data-toggle="tab">流程审批</a></li> 
			  <li><a href="#diagram" data-toggle="tab">流程图</a></li>
			</ul>
			 <div class="tab-content Report_f_title_3">
                <div class="Report_f_title_5">
                 <div class="tab-content Report_f_title_3">
                 <tags:message content="${message}" />
                  <div class="tab-pane active" id="home">
                     <div class="Report_f_title_4">
                     <tags:message content="${msg}"/>
                     
                     <div class="f_2">
								<div class="form-group col-sm-6">
								<label for="inputtext3" class="col-sm-4 control-label f_7">公司名称:</label>
								<div class="col-sm-8 f_6">
									${supplier.cname}
								</div>
							</div>
							<div class="form-group col-sm-6">
								<label for="inputtext3" class="col-sm-4 control-label f_7">供应商编号:</label>
									<div class="col-sm-8 f_6">
										${supplier.supplierNo}
									</div>
							</div>
						</div>
						<div class="f_3">
							<div class="form-group col-sm-6">
									<label for="inputtext3" class="col-sm-4 control-label f_7">供应商类型:</label>
									<div class="col-sm-8 f_6">
										<ossp:value dictType="supplierType" key="${supplier.supplierType}"/>
									</div>
							</div>
							<div class="form-group col-sm-6">
									<label for="inputtext3" class="col-sm-4 control-label f_7">供应商性质:</label>
									<div class="col-sm-8 f_6">
										<ossp:value dictType="SUPPLIER_QUALITY" key="${supplier.quality}"></ossp:value>
									</div>
							</div>
						</div>
                     <div class="f_2">
								<div class="form-group col-sm-6">
								<label for="inputtext3" class="col-sm-4 control-label f_7">供应商状态:</label>
								<div class="col-sm-8 f_6">
									<ossp:value dictType="SUPPLIER_STATUTS" key="${supplier.supplierStatus}"/>
								</div>
							</div>
							<div class="form-group col-sm-6">
								<label for="inputtext3" class="col-sm-4 control-label f_7">供应商等级:</label>
									<div class="col-sm-8 f_6">
										<ossp:value dictType="SUPPLIER_LEVEL" key="${supplier.supplierLevel}"/>
									</div>
							</div>
						</div>
						<div class="f_3">
							<div class="form-group col-sm-6">
									<label for="inputtext3" class="col-sm-4 control-label f_7">组织机构代码:</label>
									<div class="col-sm-8 f_6">
										${supplier.organizationCode}
									</div>
							</div>
							<div class="form-group col-sm-6">
									<label for="inputtext3" class="col-sm-4 control-label f_7">企业地址:</label>
									<div class="col-sm-8 f_6">
										${supplier.address}
									</div>
							</div>
						</div>
                       <div class="f_2">
								<div class="form-group col-sm-6">
								<label for="inputtext3" class="col-sm-4 control-label f_7">办公地址:</label>
								<div class="col-sm-8 f_6">
									${supplier.workAddress}
								</div>
							</div>
							<div class="form-group col-sm-6">
								<label for="inputtext3" class="col-sm-4 control-label f_7">企业网址:</label>
									<div class="col-sm-8 f_6">
										${supplier.url}
									</div>
							</div>
						</div>
						<div class="f_3">
							<div class="form-group col-sm-6">
									<label for="inputtext3" class="col-sm-4 control-label f_7">企业电话:</label>
									<div class="col-sm-8 f_6">
										${supplier.companyMoble}
									</div>
							</div>
							<div class="form-group col-sm-6">
									<label for="inputtext3" class="col-sm-4 control-label f_7">企业传真:</label>
									<div class="col-sm-8 f_6">
										${supplier.fax}
									</div>
							</div>
						</div>
						 <div class="f_2">
								<div class="form-group col-sm-6">
								<label for="inputtext3" class="col-sm-4 control-label f_7">企业邮箱:</label>
								<div class="col-sm-8 f_6">
									${supplier.email}
								</div>
							</div>
							<div class="form-group col-sm-6">
								<label for="inputtext3" class="col-sm-4 control-label f_7">员工人数:</label>
									<div class="col-sm-8 f_6">
										${supplier.comEmployees}
									</div>
							</div>
						</div>
						<div class="f_3">
							<div class="form-group col-sm-6">
									<label for="inputtext3" class="col-sm-4 control-label f_7">供应商上级名称:</label>
									<div class="col-sm-8 f_6">
										${supplier.parentSupplierName}
									</div>
							</div>
							<div class="form-group col-sm-6">
									<label for="inputtext3" class="col-sm-4 control-label f_7">市场运作年限:</label>
									<div class="col-sm-8 f_6">
										${supplier.marketRunYear}
									</div>
							</div>
						</div>
						<div class="f_2">
								<div class="form-group col-sm-6">
								<label for="inputtext3" class="col-sm-4 control-label f_7">成立日期:</label>
								<div class="col-sm-8 f_6">
									<fmt:formatDate value="${supplier.foundDate}" pattern="yyyy-MM-dd"/>
								</div>
							</div>
							
							<div class="form-group col-sm-6">
								<label for="inputtext3" class="col-sm-4 control-label f_7">供应商收款性质:</label>
									<div class="col-sm-8 f_6">
										<ossp:value dictType="IS_PUBLIC" key="${supplier.isPublic}"/>
									</div>
							</div>
						</div>
						<div class="f_3">
							<div class="form-group col-sm-6">
									<label for="inputtext3" class="col-sm-4 control-label f_7">企业简介:</label>
									<div class="col-sm-5 f_7">
									<textarea rows="5" cols="90" class="form" readonly="readonly">${supplier.summary}</textarea>
									</div>
							</div>
						</div>
					</div>
				</div>
			  	<div class="tab-pane" id="bus_tab">
				 <div class="Report_f_title_4"> 
				 		 <div class="f_2">
								<div class="form-group col-sm-6">
								<label for="inputtext3" class="col-sm-4 control-label f_7">营业执照号:</label>
								<div class="col-sm-8 f_6">
									${supplier.supplierRegister.businessNo}
								</div>
							</div>
							<div class="form-group col-sm-6">
								<label for="inputtext3" class="col-sm-4 control-label f_7">法定代表人姓名:</label>
									<div class="col-sm-8 f_6">
										${supplier.supplierRegister.legalPerson}
									</div>
							</div>
						</div>
						<div class="f_3">
							<div class="form-group col-sm-6">
									<label for="inputtext3" class="col-sm-4 control-label f_7">营业执照注册地方:</label>
									<div class="col-sm-8 f_6">
										${supplier.supplierRegister.registerAddress}
									</div>
							</div>
							<div class="form-group col-sm-6">
									<label for="inputtext3" class="col-sm-4 control-label f_7">营业执照有效期:</label>
									<div class="col-sm-8 f_6">
										<fmt:formatDate value="${supplier.supplierRegister.registerDate}" pattern="yyyy-MM-dd"/>
					  		 至 <fmt:formatDate value="${supplier.supplierRegister.endDate}" pattern="yyyy-MM-dd"/>
									</div>
							</div>
						</div>
				 		<div class="f_2">
								<div class="form-group col-sm-6">
								<label for="inputtext3" class="col-sm-4 control-label f_7">注册资金:</label>
								<div class="col-sm-8 f_6">
									${supplier.supplierRegister.registerAmount}
								</div>
							</div>
							<div class="form-group col-sm-6">
								<label for="inputtext3" class="col-sm-4 control-label f_7">注册地址:</label>
									<div class="col-sm-8 f_6">
										${supplier.supplierRegister.address}
									</div>
							</div>
						</div>
						<div class="f_3">
							<div class="form-group col-sm-6">
									<label for="inputtext3" class="col-sm-4 control-label f_7">法律经营范围:</label>
									<div class="col-sm-5 f_7">
										<textarea rows="5" cols="90" class="form" readonly="readonly">${supplier.supplierRegister.businessScope}</textarea>
									</div>
							</div>
						</div>
					</div>
				</div>
			  	<div class="tab-pane" id="tax_tab">
				 <div class="Report_f_title_4"> 
				 	<div class="f_2">
								<div class="form-group col-sm-6">
								<label for="inputtext3" class="col-sm-4 control-label f_7">税务登记证号:</label>
								<div class="col-sm-8 f_6">
									${supplier.supplierRegister.landTaxNo}
								</div>
							</div>
							<div class="form-group col-sm-6">
								<label for="inputtext3" class="col-sm-4 control-label f_7">纳税属性:</label>
									<div class="col-sm-8 f_6">
										<ossp:value dictType="SUPPLIER_TAXPROXY" key="${supplier.supplierRegister.taxProxy}"/>
									</div>
							</div>
						</div>
						<div class="f_3">
							<div class="form-group col-sm-6">
									<label for="inputtext3" class="col-sm-4 control-label f_7">税票类型:</label>
									<div class="col-sm-8 f_6">
										<ossp:value dictType="TAX_TYPE" key="${supplier.supplierRegister.taxType}"/>
									</div>
							</div>
						</div>
					</div>
				</div>
			  	<div class="tab-pane" id="contacts_tab">
				 <div class="Report_f_title_4"> 
					<table class="table table-bordered">
						<thead>
							<tr>
								<th>姓名</th>
								<th>类别</th>
								<th>职务</th>
								<th>手机号码</th>
								<th>E-mail</th>
								<th>备注</th>
							</tr>
						</thead>
						<tbody>
							<c:forEach items="${supplier.supplierContactsList}" var="item"
								varStatus="var">
								<tr>
									<td>${item.contactName}</td>
									<td><ossp:value dictType="IS_RESPONPERSON" key="${item.isResponPerson}"/></td>
									<td>${item.position}</td>
									<td>${item.mobile}</td>
									<td>${item.email}</td>
									<td>${item.remark}</td>
								</tr>
							</c:forEach>
						</tbody>
					</table>
					</div>
				</div>
				<div class="tab-pane" id="bank_tab">
				 <div class="Report_f_title_4"> 
					<table class="table table-bordered">
						<thead>
							<tr>
								<th>银行代码</th>
								<th>银行名称</th>
								<th>银行简称</th>
								<th>开户账号</th>
							</tr>
						</thead>
						<tbody>
							<c:forEach items="${supplier.supplierBankList}" var="item"
								varStatus="var">
								<tr>
									<td>${item.bankCode}</td>
									<td>${item.bankName}</td>
									<td>${item.bankSname}</td>
									<td>${item.bankNo}</td>
								</tr>
							</c:forEach>
						</tbody>
					</table>
					</div>
				</div>
			  	<div class="tab-pane" id="coopBrand_tab">
				 <div class="Report_f_title_4"> 
					<table class="table table-bordered">
						<thead>
							<tr>
								<th>品牌编码</th>
								<th>品牌中文名</th>
								<th>品牌英文名</th>
								<th>招商分类</th>
								<th>品牌等级</th>
								<th>合作属性</th>
							</tr>
						</thead>
						<tbody>
								<c:forEach items="${supplier.supplierBrandList}" var="sb">
									<tr>
										<td>${sb.brandNo}</td>
										<td>${sb.brandCname}</td>
										<td>${sb.brandEname}</td>
										<td>${sb.cateName}</td>
										<td>${sb.brandCate.brandLevel.levelName}</td>
										<td>${sb.attrName}</td>
									</tr>
								</c:forEach>
						</tbody>
					</table>
				</div>
			</div>
			 <div class="tab-pane" id="att_tab">
				 <div class="Report_f_title_4"> 
					<table class="table table-bordered">
						<tbody>
							<tr>
								<td class="text-right" style="width: 20%"><strong>组织机构代码证:</strong></td>
								<td>
									<att:down key="organization" soureBillID="${supplier.viceId}" modleName="com.maoye.ossp.biz.brand.entity.Supplier"></att:down>
								</td>
							</tr>
							<tr>
								<td class="text-right" style="width: 20%"><strong>营业执照证:</strong></td>
								<td>
									<att:down key="business" soureBillID="${supplier.viceId}" modleName="com.maoye.ossp.biz.brand.entity.Supplier"></att:down>
								</td>
							</tr>
							<tr>
								<td class="text-right" style="width: 20%"><strong>税务登记证:</strong></td>
								<td>
									<att:down key="landTax" soureBillID="${supplier.viceId}" modleName="com.maoye.ossp.biz.brand.entity.Supplier"></att:down>
								</td>
							</tr>
						</tbody>
					</table>
				</div>
				</div>
				<div class="tab-pane" id="workflow"> 
					<c:import url="/WEB-INF/views/bpm/workflow/workFlowInfo_view.jsp">
						<c:param name="formName" value="com.maoye.ossp.biz.brand.entity.Supplier" />
						<c:param name="flowKey" value="ISupplier" />
						<c:param name="businessId" value="${supplier.id}"/>
						<c:param name="method" value="${method}"/>
						<c:param name="isStart" value="${isStart}"/>
					</c:import> 	
				</div>
				<div class="tab-pane" id="diagram" style="overflow-x:auto;">
					<iframe id="diagram_iframe" scrolling="no" frameborder=0 width="100%">
					</iframe>
				</div>
		</div>
	</div>
	</div>
</div>
</div>

<div class="modal fade"  id="openUserModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content" >
     <div class="modal-header" style="background-image: linear-gradient(to bottom, #e47a54 0%, #ce2907 100%); background:#e47a54; color:#FFF;">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h5 class="modal-title" id="myModalLabel">开通供应商账号</h5>
      </div>
	      <div class="modal-body">
	      	 <input type="hidden" name="supplierId" id="supplierId" value="${supplier.id }"/>                             
	       			<table  border="0" align="center">
			    <tr>
			      <td height="37" align="center" valign="middle">
			      		<div align="right">账号名称：</div>
			      </td>
			      <td>
				        <label>
				           <input type="text"  id="username" name="username" class="form-control" placeholder="账&nbsp;号" required >
				       		 <input id="isOpenNo" type="checkbox" onclick="setNoForUserName(this,'${supplier.supplierNo}')"><span>使用供应商编码作为账号</span>
				        </label>
			      </td>
			    </tr>
			    <tr>
			      <td height="37" align="center" valign="middle">
			      		<div align="right">设置密码：</div>
			      </td>
			      <td>
				        <label>
				         <input type="password"  id="password" name="password" class="form-control" placeholder="设置密码" required >
				        </label>
			      </td>
			     </tr>
			     <tr>
			      <td height="37" align="center" valign="middle">
			      		<div align="right"> 确认密码：</div>
			      </td>
			      <td>
				        <label>
				           <input type="password" id="password2" name="password2" class="form-control" placeholder="确认密码" required >
				        </label>
			      </td>
			    </tr>
			    <tr><td colspan="2"><div class="login_text_2" id="msg"></div></td></tr>
			</table>
	     </div>
	     <div class="modal-footer" style="background-image: linear-gradient(to bottom, #feefe2 0%, #ce2907 100%); background:#feefe2;">
	        <button type="button" class="btn btn-danger btn_5" data-dismiss="modal">取消</button>
	        <button type="button" onclick="openUserSubmit('${contextPath}/biz/brand/supplierUser/openUser')"   class="btn btn-info btn_5 btn_right">确认</button>
	      </div>
       <script type="text/javascript">
        function setNoForUserName(obj,no)
        {
        	if($(obj).attr("checked") == "checked")
        	{
        		$("#username").val(no);
        		$("#username").attr("readonly","readonly");
        	}else
        	{
        		$("#username").removeAttr("readonly");
        	}
        }
		//$('#myModal').on('hidden.bs.modal', function (e) { });
		
		function openUserSubmit(url)
		{ 
			var username = $("#username").val();
			var password = $("#password").val();
			var password2 = $("#password2").val();
			var supplierId = $("#supplierId").val();
			if(username == null || username.length < 1)
			{
				top.$.jBox.tip("用户账号不可为空！",'warning');
				return;
			}
			if(password == null || password.length < 1)
			{
				top.$.jBox.tip("请设置密码！",'warning');
				return;
			}
			if(password != password2)
			{
				top.$.jBox.tip("两次密码不一致！",'warning');
				return;
			}
			$.ajax({
				   type: "POST",
				   url: url,
				   data: "username="+username+"&password="+password+"&supplierId="+supplierId,
				   success: function(textv){
					   var jsonObj = eval('(' + textv + ')');
					   if("S"==jsonObj.returnVal)
					   {
						   top.$.jBox.tip(jsonObj.msg,'success');
						   $('#openUserModal').modal('hide');
					   }else
						{
						   top.$.jBox.tip(jsonObj.msg,'warning');
						}
				   }
			});
		}
        </script>
    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div><!-- /.modal -->

<script type="text/javascript" src="${staticPath}/js/brand.js"></script>
</body>
</html>